-- slime_prop
-- create by zhuangsl
-- slime(slime_skill_id, prop_id, force)：第一个参数为冈布奥主动技能ID，第二个参数为prop_id,第三个参数为威力
-- 附加属性记录在目标的prop/special字段下

return {
    apply = function(source, target, skillId, round, para, extra)
        -- 专属技能等级
        local level;
        extra = extra or {};
        if extra["level"] then
            level = tonumber(extra["level"]);
        else
            local prop = PropM.combine(source, "gain_slime_skill", para[1]);
            level = PropM.apply(prop, 0);
        end

        -- 威力
        local force = para[3];

        -- 效果数值
        local v = force * level;

        -- 斯巴达专属加成
        local prop = PropM.combine(source, "battle_cry", 1);
        if prop[3] > 0 then
            -- 触发特技发动事件
            EventMgr.fire(event.SPECIAL_SKILL_TRIGGER, { propId = prop[1] });
        end
        v = PropM.apply(prop, v);

        -- 记录prop
        local prop = { para[2], 1, v, -1, };
        PropM.record(target, prop, "special");

        -- 增加命中动作
        SkillM.getSequence(target):hit(source, target, skillId);

        -- 返回作用目标
        return { target, };
    end,

    parse = function(desc)
        local arr = string.explode(desc, ",");
        return { tonumber(arr[1]), tonumber(arr[2]), tonumber(arr[3]), };
    end,

    -- 解析技能描述
    parseDesc = function(source, skillId, desc, para)
        -- 专属技能等级
        local prop = PropM.combine(source, "gain_slime_skill", para[1]);
        local level = PropM.apply(prop, 0);

        -- 威力
        local force = para[3];

        -- 效果数值
        local v = math.modf(force * level / 10);

        -- 斯巴达专属加成
        prop = PropM.combine(source, "battle_cry", 1);
        v = PropM.apply(prop, v);

        desc = string.gsub(desc, "{slime_prop}", v);

        return desc;
    end,
}
